//文件编码UTF-8
#include "Helper.h"

#include <string>
#include <list>

#if defined(_WIN32)
#include "WinDirent.h"
#else
#include "dirent.h"
#endif

namespace
{

} //namespace

TSP_NS_START
void Helper::getFilesInPath(const char *path, std::vector<std::string> &files)
{
    do
    {
        DIR * dir;
        struct dirent * ptr;
        dir = opendir(path);

        if (dir == nullptr)
        {
            break;
        }

        ptr = readdir(dir);
        while(ptr != NULL)
        {
            if (ptr->d_type != DT_DIR )
            {
                char buffer[1024];
                sprintf(buffer, "%s/%s", path, ptr->d_name);
                files.push_back(buffer);
            }
            ptr = readdir(dir);
        }
        closedir(dir);

    }
    while (0);
}

TSP_NS_END